package io.github.biezhi.wechat.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author wangsh
 * @date 2019-07-05 18:15
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    @Value("${wechat.assetsDir}")
    private String assetsDir;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/wechat/**").addResourceLocations("file:" + assetsDir);
    }
}
